<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>线路管理 - 工业管道安全巡检系统</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        .sidebar-gradient {
            background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
        }
    </style>
</head>
<body class="bg-gray-100">
    <!-- 顶部导航栏 -->
    <nav class="bg-white shadow-sm border-b border-gray-200 fixed w-full top-0 z-40">
        <div class="px-6 py-4">
            <div class="flex items-center justify-between">
                <div class="flex items-center">
                    <div class="flex items-center space-x-4">
                        <i class="fas fa-industry text-2xl text-blue-600"></i>
                        <div>
                            <h1 class="text-xl font-bold text-gray-800">工业管道安全巡检系统</h1>
                            <p class="text-sm text-gray-500">Pipeline Safety Inspection System</p>
                        </div>
                    </div>
                </div>
                
                <div class="flex items-center space-x-4">
                    <div class="flex items-center space-x-2 text-sm text-gray-600">
                        <i class="fas fa-bell"></i>
                        <span class="bg-red-500 text-white text-xs px-2 py-1 rounded-full">3</span>
                    </div>
                    <div class="flex items-center space-x-2">
                        <img src="https://ui-avatars.com/api/?name=Admin&background=3b82f6&color=fff" alt="用户头像" class="w-8 h-8 rounded-full">
                        <span class="text-sm font-medium text-gray-700">管理员</span>
                        <i class="fas fa-chevron-down text-gray-400"></i>
                    </div>
                </div>
            </div>
        </div>
    </nav>

    <div class="flex pt-16">
        <!-- 侧边栏 -->
        <aside class="sidebar-gradient w-64 min-h-screen fixed left-0 top-16 shadow-lg">
            <div class="p-6">
                <nav class="space-y-2">
                    <a href="dashboard.html" class="flex items-center space-x-3 text-white/80 hover:text-white hover:bg-white/10 rounded-lg px-3 py-2 transition-all">
                        <i class="fas fa-tachometer-alt w-5"></i>
                        <span>控制台</span>
                    </a>
                    <a href="line-management.html" class="flex items-center space-x-3 text-white bg-white/20 rounded-lg px-3 py-2">
                        <i class="fas fa-route w-5"></i>
                        <span>线路管理</span>
                    </a>
                    <a href="inspection-management.html" class="flex items-center space-x-3 text-white/80 hover:text-white hover:bg-white/10 rounded-lg px-3 py-2 transition-all">
                        <i class="fas fa-search w-5"></i>
                        <span>巡检管理</span>
                    </a>
                    <a href="defect-management.html" class="flex items-center space-x-3 text-white/80 hover:text-white hover:bg-white/10 rounded-lg px-3 py-2 transition-all">
                        <i class="fas fa-exclamation-triangle w-5"></i>
                        <span>缺陷管理</span>
                    </a>
                    <a href="statistics.html" class="flex items-center space-x-3 text-white/80 hover:text-white hover:bg-white/10 rounded-lg px-3 py-2 transition-all">
                        <i class="fas fa-chart-bar w-5"></i>
                        <span>统计报表</span>
                    </a>
                </nav>
            </div>
        </aside>

        <!-- 主内容区域 -->
        <main class="flex-1 ml-64 p-6">
            <!-- 面包屑导航 -->
            <div class="mb-6">
                <nav class="flex text-sm text-gray-500">
                    <a href="dashboard.html" class="hover:text-gray-700">控制台</a>
                    <i class="fas fa-chevron-right mx-2"></i>
                    <span class="text-gray-900 font-medium">线路管理</span>
                </nav>
            </div>

            <!-- 页面标题和操作按钮 -->
            <div class="flex items-center justify-between mb-6">
                <div>
                    <h1 class="text-2xl font-bold text-gray-900">线路管理</h1>
                    <p class="text-gray-600 mt-1">管理管道线路信息、里程桩设置和线路维护</p>
                </div>
                <div class="flex space-x-3">
                    <button class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors flex items-center space-x-2">
                        <i class="fas fa-plus"></i>
                        <span>新增线路</span>
                    </button>
                    <button class="bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 transition-colors flex items-center space-x-2">
                        <i class="fas fa-file-export"></i>
                        <span>导出数据</span>
                    </button>
                </div>
            </div>

            <!-- 统计卡片 -->
            <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-6">
                <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-600">总线路数</p>
                            <p class="text-3xl font-bold text-gray-900">24</p>
                        </div>
                        <div class="bg-blue-100 p-3 rounded-lg">
                            <i class="fas fa-route text-blue-600 text-xl"></i>
                        </div>
                    </div>
                    <div class="mt-4 flex items-center text-sm">
                        <span class="text-green-600 font-medium">+2</span>
                        <span class="text-gray-500 ml-1">本月新增</span>
                    </div>
                </div>

                <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-600">总里程</p>
                            <p class="text-3xl font-bold text-gray-900">485.6</p>
                            <p class="text-xs text-gray-500">公里</p>
                        </div>
                        <div class="bg-green-100 p-3 rounded-lg">
                            <i class="fas fa-road text-green-600 text-xl"></i>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-600">正常运行</p>
                            <p class="text-3xl font-bold text-gray-900">22</p>
                        </div>
                        <div class="bg-green-100 p-3 rounded-lg">
                            <i class="fas fa-check-circle text-green-600 text-xl"></i>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
                    <div class="flex items-center justify-between">
                        <div>
                            <p class="text-sm font-medium text-gray-600">维护中</p>
                            <p class="text-3xl font-bold text-gray-900">2</p>
                        </div>
                        <div class="bg-yellow-100 p-3 rounded-lg">
                            <i class="fas fa-wrench text-yellow-600 text-xl"></i>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 搜索和筛选 -->
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6">
                <div class="flex items-center justify-between">
                    <div class="flex items-center space-x-4">
                        <div class="relative">
                            <i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                            <input type="text" placeholder="搜索线路名称或编号..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
                        </div>
                        <select class="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
                            <option>全部状态</option>
                            <option>正常运行</option>
                            <option>维护中</option>
                            <option>停用</option>
                        </select>
                        <select class="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
                            <option>全部区域</option>
                            <option>东区</option>
                            <option>西区</option>
                            <option>南区</option>
                            <option>北区</option>
                        </select>
                    </div>
                    <button class="text-blue-600 hover:text-blue-800 flex items-center space-x-1">
                        <i class="fas fa-sync-alt"></i>
                        <span>刷新</span>
                    </button>
                </div>
            </div>

            <!-- 线路列表表格 -->
            <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
                <div class="px-6 py-4 border-b border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-900">线路列表</h3>
                </div>
                <div class="overflow-x-auto">
                    <table class="w-full">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                    <input type="checkbox" class="rounded border-gray-300">
                                </th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">线路编号</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">线路名称</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">起点</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">终点</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">长度</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">最近巡检</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            <tr class="hover:bg-gray-50">
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <input type="checkbox" class="rounded border-gray-300">
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">XL001</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">东区主干管道</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">泵站A</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">储罐B</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15.2 km</td>
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">
                                        正常运行
                                    </span>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2024-01-15</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <div class="flex items-center space-x-2">
                                        <button class="text-blue-600 hover:text-blue-800">
                                            <i class="fas fa-eye"></i>
                                        </button>
                                        <button class="text-green-600 hover:text-green-800">
                                            <i class="fas fa-edit"></i>
                                        </button>
                                        <button class="text-red-600 hover:text-red-800">
                                            <i class="fas fa-trash"></i>
                                        </button>
                                    </div>
                                </td>
                            </tr>
                            <tr class="hover:bg-gray-50">
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <input type="checkbox" class="rounded border-gray-300">
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">XL002</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">西区支线管道</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">分配站C</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">工厂D</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">8.7 km</td>
                                <td class="px-6 py-4 whitespace-nowrap">
                                    <span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800">
                                        维护中
                                    </span>
                                </td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2024-01-12</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                    <div class="flex items-center space-x-2">
                                        <button class="text-blue-600 hover:text-blue-800">
                                            <i class="fas fa-eye"></i>
                                        </button>
                                        <button class="text-green-600 hover:text-green-800">
                                            <i class="fas fa-edit"></i>
                                        </button>
                                        <button class="text-red-600 hover:text-red-800">
                                            <i class="fas fa-trash"></i>
                                        </button>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <!-- 分页 -->
                <div class="px-6 py-4 border-t border-gray-200">
                    <div class="flex items-center justify-between">
                        <div class="text-sm text-gray-500">
                            显示 1-10 条，共 24 条记录
                        </div>
                        <div class="flex items-center space-x-2">
                            <button class="px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50">
                                上一页
                            </button>
                            <button class="px-3 py-1 text-sm bg-blue-600 text-white rounded">
                                1
                            </button>
                            <button class="px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50">
                                2
                            </button>
                            <button class="px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50">
                                3
                            </button>
                            <button class="px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50">
                                下一页
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
</body>
</html>
<body class="bg-gray-100">
    <!-- 顶部导航栏 -->
    <nav class="bg-blue-600 text-white p-4 shadow-lg">
        <div class="flex justify-between items-center">
            <div class="flex items-center space-x-4">
                <i class="fas fa-industry text-2xl"></i>
                <h1 class="text-xl font-bold">线路管理</h1>
            </div>
            <div class="flex items-center space-x-4">
                <button class="bg-green-500 hover:bg-green-600 px-4 py-2 rounded-lg">
                    <i class="fas fa-plus mr-2"></i>新增线路
                </button>
            </div>
        </div>
    </nav>

    <div class="flex">
        <!-- 侧边栏 -->
        <aside class="bg-white w-64 min-h-screen shadow-lg">
            <nav class="p-4">
                <ul class="space-y-2">
                    <li><a href="#" class="flex items-center p-3 text-gray-700 hover:bg-gray-100 rounded-lg">
                        <i class="fas fa-tachometer-alt w-6"></i>
                        <span class="ml-3">主控制台</span>
                    </a></li>
                    <li><a href="#" class="flex items-center p-3 bg-blue-50 text-blue-600 rounded-lg">
                        <i class="fas fa-route w-6"></i>
                        <span class="ml-3">线路管理</span>
                    </a></li>
                    <li><a href="#" class="flex items-center p-3 text-gray-700 hover:bg-gray-100 rounded-lg">
                        <i class="fas fa-clipboard-check w-6"></i>
                        <span class="ml-3">巡检管理</span>
                    </a></li>
                    <li><a href="#" class="flex items-center p-3 text-gray-700 hover:bg-gray-100 rounded-lg">
                        <i class="fas fa-exclamation-triangle w-6"></i>
                        <span class="ml-3">缺陷管理</span>
                    </a></li>
                </ul>
            </nav>
        </aside>

        <!-- 主内容区 -->
        <main class="flex-1 p-6">
            <!-- 工具栏 -->
            <div class="bg-white p-4 rounded-lg shadow mb-6">
                <div class="flex justify-between items-center">
                    <div class="flex space-x-4">
                        <div class="relative">
                            <input type="text" placeholder="搜索线路..." 
                                   class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
                            <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
                        </div>
                        <select class="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
                            <option>全部状态</option>
                            <option>正常</option>
                            <option>维护中</option>
                            <option>停用</option>
                        </select>
                    </div>
                    <div class="flex space-x-2">
                        <button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg">
                            <i class="fas fa-map mr-2"></i>地图视图
                        </button>
                        <button class="bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded-lg">
                            <i class="fas fa-list mr-2"></i>列表视图
                        </button>
                    </div>
                </div>
            </div>

            <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                <!-- 线路列表 -->
                <div class="lg:col-span-1">
                    <div class="bg-white rounded-lg shadow">
                        <div class="p-4 border-b">
                            <h3 class="text-lg font-semibold">管道线路列表</h3>
                        </div>
                        <div class="divide-y">
                            <div class="p-4 hover:bg-gray-50 cursor-pointer border-l-4 border-blue-500 bg-blue-50">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h4 class="font-medium text-gray-800">输油主干线A-001</h4>
                                        <p class="text-sm text-gray-500 mt-1">总长度: 156.8km</p>
                                        <p class="text-sm text-gray-500">里程桩: 157个</p>
                                        <div class="flex items-center mt-2">
                                            <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">正常</span>
                                        </div>
                                    </div>
                                    <button class="text-gray-400 hover:text-gray-600">
                                        <i class="fas fa-ellipsis-v"></i>
                                    </button>
                                </div>
                            </div>

                            <div class="p-4 hover:bg-gray-50 cursor-pointer">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h4 class="font-medium text-gray-800">输油支线B-002</h4>
                                        <p class="text-sm text-gray-500 mt-1">总长度: 89.2km</p>
                                        <p class="text-sm text-gray-500">里程桩: 90个</p>
                                        <div class="flex items-center mt-2">
                                            <span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">维护中</span>
                                        </div>
                                    </div>
                                    <button class="text-gray-400 hover:text-gray-600">
                                        <i class="fas fa-ellipsis-v"></i>
                                    </button>
                                </div>
                            </div>

                            <div class="p-4 hover:bg-gray-50 cursor-pointer">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h4 class="font-medium text-gray-800">输油支线C-003</h4>
                                        <p class="text-sm text-gray-500 mt-1">总长度: 45.6km</p>
                                        <p class="text-sm text-gray-500">里程桩: 46个</p>
                                        <div class="flex items-center mt-2">
                                            <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">正常</span>
                                        </div>
                                    </div>
                                    <button class="text-gray-400 hover:text-gray-600">
                                        <i class="fas fa-ellipsis-v"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 地图视图 -->
                <div class="lg:col-span-2">
                    <div class="bg-white rounded-lg shadow">
                        <div class="p-4 border-b">
                            <h3 class="text-lg font-semibold">线路地图</h3>
                        </div>
                        <div class="p-4">
                            <div id="map" class="h-96 rounded-lg border border-gray-200"></div>
                        </div>
                    </div>

                    <!-- 里程桩详情 -->
                    <div class="bg-white rounded-lg shadow mt-6">
                        <div class="p-4 border-b">
                            <h3 class="text-lg font-semibold">里程桩详情 - 输油主干线A-001</h3>
                        </div>
                        <div class="p-4">
                            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-001</span>
                                        <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">正常</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4074, 39.9042</p>
                                    <p class="text-sm text-gray-500">最后巡检: 2025-01-15</p>
                                </div>

                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-002</span>
                                        <span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">待巡检</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4174, 39.9142</p>
                                    <p class="text-sm text-gray-500">计划巡检: 2025-01-17</p>
                                </div>

                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-003</span>
                                        <span class="bg-red-100 text-red-800 text-xs px-2 py-1 rounded-full">异常</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4274, 39.9242</p>
                                    <p class="text-sm text-gray-500">发现缺陷: 2025-01-14</p>
                                </div>

                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-004</span>
                                        <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">正常</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4374, 39.9342</p>
                                    <p class="text-sm text-gray-500">最后巡检: 2025-01-16</p>
                                </div>

                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-005</span>
                                        <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">正常</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4474, 39.9442</p>
                                    <p class="text-sm text-gray-500">最后巡检: 2025-01-15</p>
                                </div>

                                <div class="border border-gray-200 rounded-lg p-4">
                                    <div class="flex items-center justify-between mb-2">
                                        <span class="font-medium">A-001-006</span>
                                        <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full">巡检中</span>
                                    </div>
                                    <p class="text-sm text-gray-500">坐标: 116.4574, 39.9542</p>
                                    <p class="text-sm text-gray-500">巡检员: 李师傅</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // 初始化地图
        const map = L.map('map').setView([39.9042, 116.4074], 10);
        
        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '© OpenStreetMap contributors'
        }).addTo(map);

        // 添加管道线路
        const pipelineCoords = [
            [39.9042, 116.4074],
            [39.9142, 116.4174],
            [39.9242, 116.4274],
            [39.9342, 116.4374],
            [39.9442, 116.4474],
            [39.9542, 116.4574]
        ];

        L.polyline(pipelineCoords, {color: 'blue', weight: 4}).addTo(map);

        // 添加里程桩标记
        pipelineCoords.forEach((coord, index) => {
            const marker = L.marker(coord).addTo(map);
            marker.bindPopup(`里程桩 A-001-${String(index + 1).padStart(3, '0')}`);
        });
    </script>
</body>
</html>